﻿///***************************************************************
/// 시  스  템 : Updms.Com
/// 단위시스템 : COM
/// 계      층 : Presentation Layer
/// 프로그램명 : Com3017p
/// 파  일  명 : Com3017p.aspx.cs
/// 설      명 : 멀티파일다운로드
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2013-07-24 송시명   최초 작성
///***************************************************************
using System;
using System.Data;
using System.IO;
using System.Text;
using System.Web;

using SMFramework.Configuration;
using SMFramework.Data;
using SMFramework.Utility;

using Base.Dac;
using Base.AppFramework;
using Base.AppFramework.Web.UI.CommandBar;

using Updms.Com.Exe;
using System.Web.UI.WebControls;

namespace Updms.Com
{
	public partial class Com3017p : Updms.Common.BaseClass.PageBase
	{
		#region 콘트롤

		public static readonly string PID = "Com3017p";
		Global global = new Global();

		private string activity_id = "";
		private string activity_cd = "";

		#endregion

		#region Page_Load, OnPageLoad

		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				OnPageLoad();
				if (CheckViewAuth())
				{
					SetInit();
					GetFileInfoByActivityId();
				}
			}
			SetGridViewHeader(global.GetColumnListByPgmId(PID, LANG_SET));
		}

		//OnPageLoad
		private void OnPageLoad()
		{
			SetLiterals(global.GetLabelInfoByPgmId(PID, LANG_SET));
		}

		#endregion

		#region CheckViewAuth

		//인증검사
		private bool CheckViewAuth()
		{
			using (AccessCheck access = new AccessCheck())
			{
				//접근권한 체크
				if (!access.CheckPgmAccessGrant(PID, USER_ID, ACCESS_LOG_INFO))
				{
					Response.Redirect(URL_NO_AUTHORITY_REDIRECT_POPUP);	//사용자의 권한은 요청하신 페이지를 볼 수 없습니다
					return false;
				}
				return true;
			}
		}

		#endregion

		#region SetInit

		// SetInit
		private void SetInit()
		{
			if (Request.QueryString["activity_id"] != null)
			{
				activity_id = Server.UrlDecode(Request.QueryString["activity_id"].ToString().Trim());
			}
			if (Request.QueryString["activity_cd"] != null)
			{
				activity_cd = Server.UrlDecode(Request.QueryString["activity_cd"].ToString().Trim());
			}
		}

		#endregion

		#region GetFileInfoByActivityId

		//GetFileInfoByActivityId
		private void GetFileInfoByActivityId()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("activity_id", typeof(int), activity_id);
			lo_dp.AddProperty("activity_cd", typeof(string), activity_cd);

			int cnt = 0;
			if (!String.IsNullOrEmpty(activity_id))
			{
				using (Com9010m_NT _Com9010m_NT = new Com9010m_NT())
				{
					lo_ds.Merge(_Com9010m_NT.GetFileInfoByActivityId(lo_dp));
				}
				cnt = DataSetUtil.GetRowCount(lo_ds, "UPDMS_COM_FILE");
			}

			GridView1.DataSource = lo_ds;
			GridView1.DataBind();
		}

		#endregion

		#region GridView이벤트

		//RowDataBound
		protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
		{
			if (e.Row.RowType == DataControlRowType.DataRow)
			{
				e.Row.Cells[0].Text = (e.Row.RowIndex + 1).ToString();
			}
		}

		#endregion
		
	}
}